package com.dailywork.basepro.thread.container;

import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class UseConcurrentMap {

    public static void main(String[] args) {
        ConcurrentHashMap chm = new ConcurrentHashMap();
        chm.put("k1", "v1");
        chm.put("k2", "v2");
        chm.put("k3", "v3");
        chm.putIfAbsent("k4", "vvvvv");

        for (Iterator localIterator = chm.entrySet().iterator(); localIterator.hasNext(); ) {
            Map.Entry me = (Map.Entry) localIterator.next();
            System.out.println("key:" + ((String) me.getKey()) + ",value:" + me.getValue());
        }
    }
}
